using System;
using System.Collections.Generic;
using System.Text;
using System.Web;
using System.Net;

namespace Geoconcepts.SemanticServices
{
    public class NetworkSettings
    {
        public static void SetProxySettings()
        {
            WebProxy proxyDefault = (WebProxy)WebProxy.GetDefaultProxy();

            if (proxyDefault.Address != null && proxyDefault.Address.Host == "proxy01")
            {
                java.lang.System.getProperties().put("http.proxySet", "true");
                java.lang.System.getProperties().put("http.proxyHost", "proxy01");
                java.lang.System.getProperties().put("http.proxyPort", "8080");
            }
        }

        public static bool ConnectionExists()
        {
            try
            {
                System.Net.Sockets.TcpClient tcpClient = new System.Net.Sockets.TcpClient("www.google.com", 80);
                tcpClient.Close();
                return true;
            }
            catch (System.Exception ex)
            {
                return false;
            }
        }

    }
}
